<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 删除字符使字符串变好 -->
    <script>
      function makeFancyString(s) {
        //把所有连续出现2次以上的字符替换为截取后的2字符
        return s.replaceAll(/(.)\1{2,}/g, a => a.slice(0, 2))
      }
      console.log(makeFancyString('leeetcode'))
    </script>
  </body>
</html>
